﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using DataAccessLayer.Entity;
using System.Data;
namespace DataAccessLayer.Adapter
{
    public class KVUTAdapter
    {
        clsKetNoiCSDL kn = new clsKetNoiCSDL();
        //DataTable dt;
        object kq;
        public DataTable LoadKVUT()
        {
            return kn.LoadDL("tbKVUT_LoadKVUT");
        }
        public void ThemKVUT(clsKVUT clsKVUT)
        {
            int Npa = 3;
            string sql = "tbKVUT_InsertKVUT";
            string []name=new string[Npa];
            object[]value=new object[Npa];
            name[0] = "@MaKVUT"; value[0] = clsKVUT.MaKVUT;
            name[1] = "@TenKVUT"; value[1] = clsKVUT.TenKVUT;
            name[2] = "@DiemKVUT"; value[2] = clsKVUT.DiemKVUT;
            kn.UpdateDL(sql,name,value,Npa);
        }
        public void SuaKVUT(clsKVUT clsKVUT)
        {
            int Npa = 3;
            string sql = "tbKVUT_Update";
            string[] name = new string[Npa];
            object[] value = new object[Npa];
            name[0] = "@MaKVUT"; value[0] = clsKVUT.MaKVUT;
            name[1] = "@TenKVUT"; value[1] = clsKVUT.TenKVUT;
            name[2] = "@DiemKVUT"; value[2] = clsKVUT.DiemKVUT;
            kn.UpdateDL(sql, name, value, Npa);
        }
        public void XoaKVUT(clsKVUT clsKVUT)
        {
            int Npa = 1;
            string sql = "tbKVUT_Delete";
            string[] name = new string[Npa];
            object []value=new object[Npa];
            name[0] = "@MaKVUT"; value[0] = clsKVUT.MaKVUT;
            kn.UpdateDL(sql,name,value,Npa);
        }
        public object KiemTraTrungMa(clsKVUT clsKV)
        {
            string sql = "tbKVUT_KiemTraMaKVUT";
            int N = 1;
            string[] name = new string[N];
            object[] value = new object[N];
            name[0] = "@MaKVUT"; value[0] = clsKV.MaKVUT;
            kq = kn.KTTrungMa(sql, name, value, N);
            return kq;
        }
    }
}
